// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import 'lib-flexible'
import './assets/css/style.css'
import './assets/css/font-awesome.css'
import axios from 'axios'
Vue.prototype.axios = axios

Vue.filter('tabs', value => {
  switch (value) {
    case 'ask':
      return value = '提问'
      break;
    case 'share':
      return value = '分享'
      break;
    case 'job':
      return value = '招聘'
      break;
    default:
      break;
  }
})
Vue.filter('lasttime', value => {
  value = new Date(value)
  var Vyear = value.getFullYear()
  var Vmonth = value.getMonth()+1
  var Vday = value.getDate()
  var Vhour = value.getHours()
  var Vmin = value.getMinutes()
  var Vsecond = value.getSeconds()
//  现在
  var time = new Date()
  var year = time.getFullYear()
  var month = time.getMonth()+1
  var day = time.getDate()

  var hour = time.getHours()
  var min = time.getMinutes()
  var second = time.getSeconds()

  if(month > Vmonth){
    var m = month - Vmonth
    return m+"月前"
  }else if ( month <= Vmonth && day > Vday) {

    var days = day -Vday
    return days+'天前'
  }else if(month == Vmonth && day == Vday && hour > Vhour){
    var hours = hour - Vhour
    return hours+"小时前"
  }else if(month == Vmonth && day == Vday && hour == Vhour){
    var mins = min - Vmin
    return mins+"分钟前"
  }
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: {
    App
  }
})
